const BleConstants = {
  SCAN_TIME_OUT: 10,
  MIN_RSSI_SAMPLES: 3, // Minimum number of samples relevant for RSSI calculation
  FAR_RSSI_VALUE: -100.0, // A RSSI value for devices considered to be really far (more than 4 meters)
  NEAR_RSSI_LIMIT: -70, // The limit where the RSSI average considered to be a near device if it's greater than this value.
}

export enum DeviceState {
  Idle = 'Idle',
  InitTreatment = 'InitTreatment',
  Treatment = 'Treatment',
  Error = 'Error',
  Pause = 'Pause',
  Shutdown = 'Shutdown',
  Unknown = 'Unknown',
}

export const DeviceStateValue = {
  [DeviceState.Idle]: 1,
  [DeviceState.InitTreatment]: 2,
  [DeviceState.Treatment]: 3,
  [DeviceState.Error]: 4,
  [DeviceState.Pause]: 5,
  [DeviceState.Shutdown]: 6,
  [DeviceState.Unknown]: -1,
}

export enum ResponseCode {
  IllegalParameters = 'IllegalParameters',
  DeviceIsNotAuthenticated = 'DeviceIsNotAuthenticated',
  TreatmentIsAlreadyActive = 'TreatmentIsAlreadyActive',
  TreatmentIsBlocked = 'TreatmentIsBlocked',
  TreatmentIsNotActive = 'TreatmentIsNotActive',
  TreatmentIsAlreadyPaused = 'TreatmentIsAlreadyPaused',
  ExceededMaximumPausesInTreatment = 'ExceededMaximumPausesInTreatment',
  TreatmentIsInitializing = 'TreatmentIsInitializing',
  NoMoreTreatmentsLeft = 'NoMoreTreatmentsLeft',
  RequestForPassword = 'RequestForPassword',
  InvalidPassword = 'InvalidPassword',
  ExceedMaximumPasswordTrials = 'ExceedMaximumPasswordTrials',
  Unknown = 'Unknown',
}

export enum ResponseState {
  ACK = 'ack',
  NACK = 'nack',
  NO_RESPONSE = 'no_response'
}

export enum EndTreatmentReason {
  NO_TREATMENT = 0,
  AUTO_COMPLETE = 1,
  MANUAL_STOP = 2,
  STOPPED_BY_ERROR = 3,
  AUTO_COMPLETE_AFTER_PAUSE = 4,
  AUTO_COMPLETE_AFTER_NO_LOAD = 5,
  MANUAL_STOP_WHILE_IN_PAUSE = 6,
}

export enum BleConnectivityStatus {
  Initial = 'Initial',
  Disconnected = 'Disconnected',
  Searching = 'Searching',
  Searched = 'Searched',
  SearchingTimedOut = 'SearchingTimedOut',
  WaitingForConnection = 'WaitingForConnection',
  Connecting = 'Connecting',
  Connected = 'Connected',
  ConnectedAndAuthenticated = 'ConnectedAndAuthenticated',
  AuthenticationFailed = 'AuthenticationFailed',
  ConnectionTimedOut = 'ConnectionTimedOut',
}

export enum BleConnectivityError {
  AuthenticationFailed = 'AuthenticationFailed',
  ConnectionTimedOut = 'ConnectionTimedOut',
  SearchingTimedOut = 'SearchingTimedOut',
  IllegalStateException = 'IllegalStateException',
  ConfigurationFailed = 'ConfigurationFailed',

}

export enum ReportCode {
  NO_VALUE = -1,
  ILLEGAL_PARAMETERS = 0x100,
  ILLEGAL_COMMAND = 0x101,
  DEVICE_IS_NOT_AUTHENTICATED = 0x102,
  COMMAND_PARSING_FAILED = 0x102,
  ATTEMPT_TO_START_A_TREATMENT_WHILE_THE_DEVICE_IS_OPERATING_A_TREATMENT = 0x200,
  TREATMENT_FAILURE = 0x201,
  ATTEMPT_TO_STOP_A_TREATMENT_WHILE_THE_DEVICE_IS_NOT_ACTIVE = 0x202,
  DEVICE_DISCONNECTED_FROM_BODY = 0x203,
  DEVICE_RECONNECTED_TO_BODY = 0x204,
  DEVICE_REPORTS_NO_TREATMENTS_ARE_LEFT_AND_ENTERS_ERROR_STATE = 0x205,
  ATTEMPT_TO_PAUSE_WHILE_THE_DEVICE_IS_PAUSED = 0x207,
  NUMBER_OF_PAUSES_EXCEEDED_THE_MAXIMUM_ALLOWED = 0x208,
  TREATMENT_IS_AT_INIT_PHASE = 0x209,
  ATTEMPT_TO_RESUME_WHILE_THE_TREATMENT_IS_NOT_PAUSED = 0x20A,
  ATTEMPT_TO_START_A_TREATMENT_WHILE_ITS_BLOCKED_BY_THE_DEVICE = 0x20B,
  NOT_ENOUGH_REMAINING_TIME_TO_EXECUTE_A_TREATMENT = 0x20C,
  THE_TREATMENT_ENDED = 0x20E,
  DEVICE_IS_SHUTTING_DOWN = 0x300,
  NO_ACTIVITY_TIMEOUT = 0x301,
  DEVICE_KEEP_ALIVE_TIMEOUT = 0x302,
  DEVICE_WATCH_DOG_EXPIRED = 0x400,
  BUILT_TEST_STATUS = 0x500,
  DEVICE_REQUESTS_A_PASSWORD_TO_CONCLUDE_THE_AUTHENTICATION = 0x600,
  ON_THE_AUTHENTICATION_PROCESS_ATTEMPT_TO_SEND_A_PASSWORD_WITHOUT_SENDING_THE_MOBILE_UDID = 0x601,
  THE_APPLICATION_EXCEEDED_THE_MAXIMUM_TRIALS_FOR_SENDING_THE_PASSWORD = 0x602,
  THE_PASSWORD_SENT_BY_THE_APPLICATION_IS_INVALID = 0x603,
  THE_PASSWORD_SIZE_IS_INVALID = 0x604,
  THE_OTA_PROCESS_FAILED = 0x700,
  RMNG_PARAM_WRITTEN_TO_FLASH_ON_STIM = 0x4000,
  RMNG_PARAM_REQ_TO_STOR_BONT_INFO = 0x4001,
  RMNG_LONG_PULSE_ALERT = 0x4002,
  RESERVE_1 = 0x4003,
  RESERVE_2 = 0x4004,
  RESERVE_3 = 0x4005,
  RESERVE_4 = 0x4006,
  RESERVE_5 = 0x4007,
  RESERVE_6 = 0x4008,
  RESERVE_7 = 0x4009,
  ERROR = 0xF000
}

export default BleConstants
